#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:3.1 AS base
ENV LANG "C.UTF-8"
ENV ASPNETCORE_ENVIRONMENT ${ASPNETCORE_ENVIRONMENT}
ENV TZ "Asia/Shanghai"
WORKDIR /app
EXPOSE 80
EXPOSE 443

# 修改openssl配置文件  
RUN sed -i 's/SECLEVEL=2/SECLEVEL=1/' /etc/ssl/openssl.cnf \  
    && echo "\n[system_default_sect]" >> /etc/ssl/openssl.cnf \  
    && echo "MinProtocol = TLSv1.2" >> /etc/ssl/openssl.cnf \  
    && echo "CipherString = DEFAULT@SECLEVEL=1" >> /etc/ssl/openssl.cnf 

FROM mcr.microsoft.com/dotnet/sdk:3.1 AS build
WORKDIR /src
COPY ["VisionSurface.Web/VisionSurface.Web.csproj", "VisionSurface.Web/"]
COPY ["VisionSurface.Service/VisionSurface.Service.csproj", "VisionSurface.Service/"]
COPY ["VisionCloud.Domain/VisionCloud.Domain.csproj", "VisionCloud.Domain/"]
COPY ["VisionCloud.Core/VisionCloud.Core.csproj", "VisionCloud.Core/"]
COPY ["VisionCloud.Utility/VisionCloud.Utility.csproj", "VisionCloud.Utility/"]
COPY ["Language.Resource/Language.Resource.csproj", "Language.Resource/"]
RUN dotnet restore "VisionSurface.Web/VisionSurface.Web.csproj" -s https://api.nuget.org/v3/index.json -s http://10.8.203.94:5555/v3/index.json
COPY . .
WORKDIR "/src/VisionSurface.Web"
RUN dotnet build "VisionSurface.Web.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "VisionSurface.Web.csproj" -c Release -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
COPY --from=build /src/VisionSurface.Web/bin2/ /app/
ENTRYPOINT ["dotnet", "VisionSurface.Web.dll"]
